package com.ruoyi.system.service.impl;

import java.util.List;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.FlowerMapper;
import com.ruoyi.system.domain.Flower;
import com.ruoyi.system.service.IFlowerService;

/**
 * 鲜花Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-03-26
 */
@Service
public class FlowerServiceImpl implements IFlowerService 
{
    @Autowired
    private FlowerMapper flowerMapper;

    /**
     * 查询鲜花
     * 
     * @param id 鲜花主键
     * @return 鲜花
     */
    @Override
    public Flower selectFlowerById(Long id)
    {
        return flowerMapper.selectFlowerById(id);
    }

    /**
     * 查询鲜花列表
     * 
     * @param flower 鲜花
     * @return 鲜花
     */
    @Override
    public List<Flower> selectFlowerList(Flower flower)
    {
        return flowerMapper.selectFlowerList(flower);
    }

    /**
     * 新增鲜花
     * 
     * @param flower 鲜花
     * @return 结果
     */
    @Override
    public int insertFlower(Flower flower)
    {
        return flowerMapper.insertFlower(flower);
    }

    /**
     * 修改鲜花
     * 
     * @param flower 鲜花
     * @return 结果
     */
    @Override
    public int updateFlower(Flower flower)
    {
        return flowerMapper.updateFlower(flower);
    }

    /**
     * 批量删除鲜花
     * 
     * @param ids 需要删除的鲜花主键
     * @return 结果
     */
    @Override
    public int deleteFlowerByIds(Long[] ids)
    {
        return flowerMapper.deleteFlowerByIds(ids);
    }

    /**
     * 删除鲜花信息
     * 
     * @param id 鲜花主键
     * @return 结果
     */
    @Override
    public int deleteFlowerById(Long id)
    {
        return flowerMapper.deleteFlowerById(id);
    }

    @Override
    public PageInfo<Flower> getFlowerList(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<Flower> flowerList = flowerMapper.selectFlowerList(null);
        return new PageInfo<>(flowerList);
    }
}
